const { Article } = require('../../model/article');
const { Comment } = require('../../model/comment');

module.exports = async (req, res) => {
    // 接受文章id
    const id = req.query.id;
    // 根据id查询信息
    let article = await Article.findOne({ _id: id }).populate('author');
    // 查询当前文章所对应的评论信息
    let comments = await Comment.find({ aid: id }).populate('uid')

    //    res.send(comments);
    //    return;
    // res.send('欢迎来到博客文章详情页面')
    res.render('home/article.art', { article, comments });
}